package com.atguigu.factory.improve;


import com.atguigu.factory.CheesePizza;
import com.atguigu.factory.GreekPizza;
import com.atguigu.factory.Pizza;

/**
 * @ClassName SimpleFactory
 * @Description 简单工厂模式,
 * @Author HongJian-Yang
 * @Date 2020/6/17 0:01
 * @Version 1.0
 */
public class SimpleFactory {
    public Pizza createPizza(String orderType) {
        if ("CheesePizza".equals(orderType)) {
            return new CheesePizza().setName(orderType);
        } else if ("GreekPizza".equals(orderType)) {
            return new GreekPizza().setName(orderType);
        } else {
            return null;
        }
    }
}
